<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-memo语法(了解)</title> 
</head>
<body>
  <div id="app">
    <div v-memo="[name]">
      <h2> 姓名: {{name}} </h2> <!--要求只有name发生变化时,其他元素才会发生改变-->
      <h2> 年龄: {{age}} </h2>
      <h2> 身高: {{height}} </h2>
    </div>
    <button @click="updateInfo"> 修改姓名和年龄 </button>
    <button @click="updateAge"> 修改年龄 </button>
  </div>
  
  <script src="../lib/vue.js"></script>
  <script>
    // 使用vue
    const app = Vue.createApp({
      data: function(){
        return {
          name: "Hello v-memo"
          , age: 19
          , height: 1.88
        }
      }
      ,methods: {
        updateInfo: function() {
          this.name = "kobbe"
        }
        , updateAge: function() {
          this.age = 22
        }
      }
    }
    )
    // 挂载 
    app.mount("#app")
    
  </script>

</body>
</html>
